// 示例开始，以下几行代码即可成功入会专属云平台:
var inMeeting = false; //开关
window.onload = function () {
  getDemoConfig()
  window.zjsdk3 = new ZjSdk3();
  // 重写回调函数
  zjsdk3.on_dev_call_succeed = demo_on_dev_call_succeed
}

// 呼叫成功时的回调
function demo_on_dev_call_succeed() {
  //回显本地视频
  zjsdk3.local_dev_show_myvideo(['local_video'], true)
  //显示远端视频
  zjsdk3.show_video_by_orders(['farend_video', 'farend_video2', 'farend_video3', 'farend_video4', 'farend_video5'])
}

// 点击入会
window.start_call = async function () {
  if (!inMeeting) {
    inMeeting = true
    // 将用户输入的服务器地址、会议号、入会密码、昵称存入配置文件中
    setDemoConfig()
    // 呼入会议
    await zjsdk3.make_call_now(demo_config.server.ip, demo_config.server.port, demo_config.meeting.cuid, demo_config.meeting.joinpwd, demo_config.meeting.nick_name, demo_config.meeting.account)
  }
};

// 离开会议室
window.disconnect = async function () {
  await zjsdk3.disconnect_now()
  zjsdk3.local_dev_show_myvideo([], true)
  window.inMeeting = false
};